home *** CD-ROM | disk | FTP | other *** search
/ Champak 83 / (Vol 83) My Disc.iso / Games / chees_mouse.swf / scripts / frame_3 / DoAction.as
Text File  |  2008-08-08  |  6KB  |  163 lines

  1. function build_m()
  2. {
  3.    attachMovie("empty","c",1);
  4.    c._x = 25;
  5.    c._y = 50;
  6.    var _loc7_ = 0;
  7.    var _loc6_ = t_hor * t_ver + 2;
  8.    if(_root["e5_pos_" + current_l_num].length == undefined && _root["ch_pos_" + current_l_num].length == undefined)
  9.    {
  10.       var _loc5_ = _loc6_ + 1;
  11.    }
  12.    else if(_root["e5_pos_" + current_l_num].length != undefined && _root["ch_pos_" + current_l_num].length == undefined)
  13.    {
  14.       _loc5_ = _loc6_ + _root["e5_pos_" + current_l_num].length + 1;
  15.    }
  16.    else if(_root["e5_pos_" + current_l_num].length == undefined && _root["ch_pos_" + current_l_num].length != undefined)
  17.    {
  18.       _loc5_ = _loc6_ + _root["ch_pos_" + current_l_num].length + 1;
  19.    }
  20.    else if(_root["e5_pos_" + current_l_num].length != undefined && _root["ch_pos_" + current_l_num].length != undefined)
  21.    {
  22.       _loc5_ = _loc6_ + _root["e5_pos_" + current_l_num].length + _root["ch_pos_" + current_l_num].length + 1;
  23.    }
  24.    var _loc3_ = 0;
  25.    while(_loc3_ < t_ver)
  26.    {
  27.       var _loc2_ = 0;
  28.       while(_loc2_ < t_hor)
  29.       {
  30.          c.attachMovie("t","t_" + _loc2_ + "_" + _loc3_,_loc7_);
  31.          c["t_" + _loc2_ + "_" + _loc3_]._x = _loc2_ * t_size;
  32.          c["t_" + _loc2_ + "_" + _loc3_]._y = _loc3_ * t_size;
  33.          c["t_" + _loc2_ + "_" + _loc3_].gotoAndStop(current_m[_loc3_][_loc2_] + 1);
  34.          _loc7_ = _loc7_ + 1;
  35.          var _loc4_ = 0;
  36.          while(_loc4_ < _root["e1_pos_" + current_l_num].length)
  37.          {
  38.             if(_loc2_ == _root["e1_pos_" + current_l_num][_loc4_][0] && _loc3_ == _root["e1_pos_" + current_l_num][_loc4_][1])
  39.             {
  40.                c.attachMovie("e1","e1_" + _loc4_,_loc5_);
  41.                c["e1_" + _loc4_]._x = _loc2_ * t_size + t_size / 2;
  42.                c["e1_" + _loc4_]._y = _loc3_ * t_size + t_size / 2;
  43.                _loc5_ = _loc5_ + 1;
  44.             }
  45.             _loc4_ = _loc4_ + 1;
  46.          }
  47.          _loc4_ = 0;
  48.          while(_loc4_ < _root["e2_pos_" + current_l_num].length)
  49.          {
  50.             if(_loc2_ == _root["e2_pos_" + current_l_num][_loc4_][0] && _loc3_ == _root["e2_pos_" + current_l_num][_loc4_][1])
  51.             {
  52.                c.attachMovie("e2","e2_" + _loc4_,_loc5_);
  53.                c["e2_" + _loc4_]._x = _loc2_ * t_size + t_size / 2;
  54.                c["e2_" + _loc4_]._y = _loc3_ * t_size + t_size / 2;
  55.                _loc5_ = _loc5_ + 1;
  56.             }
  57.             _loc4_ = _loc4_ + 1;
  58.          }
  59.          _loc4_ = 0;
  60.          while(_loc4_ < _root["e3_pos_" + current_l_num].length)
  61.          {
  62.             if(_loc2_ == _root["e3_pos_" + current_l_num][_loc4_][0] && _loc3_ == _root["e3_pos_" + current_l_num][_loc4_][1])
  63.             {
  64.                c.attachMovie("e3","e3_" + _loc4_,_loc5_);
  65.                c["e3_" + _loc4_]._x = _loc2_ * t_size + t_size / 2;
  66.                c["e3_" + _loc4_]._y = _loc3_ * t_size + t_size / 2;
  67.                _loc5_ = _loc5_ + 1;
  68.             }
  69.             _loc4_ = _loc4_ + 1;
  70.          }
  71.          _loc4_ = 0;
  72.          while(_loc4_ < _root["e4_pos_" + current_l_num].length)
  73.          {
  74.             if(_loc2_ == _root["e4_pos_" + current_l_num][_loc4_][0] && _loc3_ == _root["e4_pos_" + current_l_num][_loc4_][1])
  75.             {
  76.                c.attachMovie("e4","e4_" + _loc4_,_loc5_);
  77.                c["e4_" + _loc4_]._x = _loc2_ * t_size + t_size / 2;
  78.                c["e4_" + _loc4_]._y = _loc3_ * t_size + t_size / 2;
  79.                _loc5_ = _loc5_ + 1;
  80.             }
  81.             _loc4_ = _loc4_ + 1;
  82.          }
  83.          _loc4_ = 0;
  84.          while(_loc4_ < _root["e5_pos_" + current_l_num].length)
  85.          {
  86.             if(_loc2_ == _root["e5_pos_" + current_l_num][_loc4_][0] && _loc3_ == _root["e5_pos_" + current_l_num][_loc4_][1])
  87.             {
  88.                c.attachMovie("e5","e5_" + _loc4_,_loc6_);
  89.                c["e5_" + _loc4_]._x = _loc2_ * t_size + t_size / 2;
  90.                c["e5_" + _loc4_]._y = _loc3_ * t_size + t_size / 2;
  91.                _loc6_ = _loc6_ + 1;
  92.             }
  93.             _loc4_ = _loc4_ + 1;
  94.          }
  95.          _loc4_ = 0;
  96.          while(_loc4_ < _root["ch_pos_" + current_l_num].length)
  97.          {
  98.             if(_loc2_ == _root["ch_pos_" + current_l_num][_loc4_][0] && _loc3_ == _root["ch_pos_" + current_l_num][_loc4_][1])
  99.             {
  100.                c.attachMovie("ch","ch_" + _loc4_,_loc6_);
  101.                c["ch_" + _loc4_]._x = _loc2_ * t_size + t_size / 2;
  102.                c["ch_" + _loc4_]._y = _loc3_ * t_size + t_size / 2;
  103.                _loc6_ = _loc6_ + 1;
  104.             }
  105.             _loc4_ = _loc4_ + 1;
  106.          }
  107.          if(_loc2_ == _root["mh_pos_" + current_l_num][0] && _loc3_ == _root["mh_pos_" + current_l_num][1])
  108.          {
  109.             c.attachMovie("mh","mh",_loc6_);
  110.             c.mh._x = _loc2_ * t_size + t_size / 2;
  111.             c.mh._y = _loc3_ * t_size + t_size / 2;
  112.             _loc6_ = _loc6_ + 1;
  113.          }
  114.          _loc2_ = _loc2_ + 1;
  115.       }
  116.       _loc3_ = _loc3_ + 1;
  117.    }
  118.    if(c.p._x == null)
  119.    {
  120.       c.attachMovie("p","p",_loc5_);
  121.       c.p._x = _root["p_pos_" + current_l_num][0] * t_size + t_size / 2;
  122.       c.p._y = _root["p_pos_" + current_l_num][1] * t_size + t_size / 2;
  123.    }
  124. }
  125. function break_m()
  126. {
  127.    removeMovieClip(c);
  128. }
  129. function write_texts()
  130. {
  131.    stats = "Level: " + current_l_num + "/" + total_l + "     " + "Cheese: " + ch_amt + "/" + _root["ch_pos_" + current_l_num].length;
  132.    if(_root["ch_pos_" + current_l_num].length == undefined)
  133.    {
  134.       stats = "Level: " + current_l_num + "/" + total_l + "     " + "Cheese: " + ch_amt + "/0";
  135.    }
  136. }
  137. function die()
  138. {
  139.    ch_amt = 0;
  140.    break_m();
  141.    removeMovieClip(c.p);
  142.    gotoAndStop("pregame");
  143. }
  144. function win()
  145. {
  146.    current_l_num++;
  147.    current_m = _root["m_" + current_l_num];
  148.    ch_amt = 0;
  149.    break_m();
  150.    removeMovieClip(c.p);
  151.    gotoAndStop("pregame");
  152. }
  153. var total_l = 15;
  154. stop();
  155. _quality = "high";
  156. var t_size = 20;
  157. var m_width = 300;
  158. var m_height = 300;
  159. var t_hor = m_width / t_size;
  160. var t_ver = m_height / t_size;
  161. var p_action = null;
  162. var ch_amt = 0;
  163.